﻿package mortal.game.view.copy.crossMainCity.panels
{
    import com.mui.controls.*;
    import extend.language.*;
    import flash.events.*;
    import flash.text.*;
    import mortal.common.global.*;
    import mortal.game.cache.*;
    import mortal.game.mvc.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;

    public class MainCityKOPanel extends GSprite
    {
        private var _btnEnter:GLoadingButton;
        private var _txtKOTime:GTextFiled;
        private var _txtFinalTime:GTextFiled;
        private var _txtCannotSignUp:GTextFiled;

        public function MainCityKOPanel()
        {
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            var _loc_1:TextFormat = null;
            super.createDisposedChildrenImpl();
            pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.MainCityWinBg, 0, 0, this));
            pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.MainCityKOTime, 93, 229, this));
            pushUIToDisposeVec(UIFactory.gImageBitmap(ImagesConst.MainCityFinalTime, 419, 229, this));
            this._btnEnter = UIFactory.gLoadingButton(ImagesConst.MainCityKOEnterBtn_upSkin, 335, 187, 206, 160, this);
            _loc_1 = GlobalStyle.textFormatLv;
            _loc_1.size = 16;
            this._txtKOTime = UIFactory.gTextField("", 144, 271, 300, 26, this, _loc_1);
            this._txtKOTime.mouseEnabled = false;
            this._txtKOTime.text = Cache.instance.mainCity.getNextOpenDayStr() + "  19:30-19:50";
            this._txtFinalTime = UIFactory.gTextField("", 537, 271, 300, 26, this, _loc_1);
            this._txtFinalTime.mouseEnabled = false;
            this._txtFinalTime.text = Cache.instance.mainCity.getNextOpenDayStr() + "  19:50-20:20";
            this._btnEnter.configEventListener(MouseEvent.CLICK, this.enterHandler);
            this._txtCannotSignUp = UIFactory.gTextField(Language.getString(20954), 370, 500, 240, 24, this);
            if (Cache.instance.mainCity.canIEnterCurBattle && Cache.instance.mainCity.isKOBattleDuration)
            {
                this._txtCannotSignUp.textColor = 65280;
                this._txtCannotSignUp.text = Language.getString(20955);
            }
            else
            {
                this._txtCannotSignUp.textColor = 16711680;
                this._txtCannotSignUp.text = Language.getString(20954);
                if (!Cache.instance.mainCity.isKOBattleDuration)
                {
                    this._txtCannotSignUp.text = Language.getString(20956);
                }
            }
            return;
        }// end function

        private function enterHandler(param1) : void
        {
            GameProxy.copy.enterCrossMainCityKOBattle();
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._btnEnter.dispose(param1);
            this._btnEnter = null;
            this._txtKOTime.dispose(param1);
            this._txtKOTime = null;
            this._txtFinalTime.dispose(param1);
            this._txtFinalTime = null;
            this._txtCannotSignUp.dispose(param1);
            this._txtCannotSignUp = null;
            return;
        }// end function

    }
}
